package controllers

import actors.WorkflowMissionExecutor
import akka.stream.Materializer
import dao._
import play.api.i18n.I18nSupport
import play.api.libs.ws.WSClient
import play.api.mvc.{AbstractController, ControllerComponents}
import shared.Pojo._
import tool.Tool

import javax.inject.Inject
import upickle.default._
import tool.Pojo._

import java.io.File

/**
 * Created by yz on 16/9/2022
 */
class TestController @Inject()(cc: ControllerComponents)(
  implicit val materializer: Materializer,
  implicit val workflowMissionDao: WorkflowMissionDao,
  implicit val missionDao: MissionDao,
  implicit val modeDao: ModeDao,
  implicit val hmdbKeggInfoDao: HmdbKeggInfoDao,
  implicit val hmdbOtherNameKeggDao: HmdbOtherNameKeggDao,
  implicit val matrixFileDataDao: MatrixFileDataDao,
  implicit val keggInfoDao: KeggInfoDao,
  implicit val ws: WSClient,
) extends AbstractController(cc) with I18nSupport {

  def test = Action { implicit request =>
    implicit val dao = MyDao(missionDao, modeDao, hmdbKeggInfoDao, hmdbOtherNameKeggDao, workflowMissionDao,
      matrixFileDataDao, keggInfoDao = keggInfoDao)
    val missionId="1077"
    val parentDir=new File(s"C:\\metabo_clound_platform_database\\user\\13\\workflow_mission\\featureSelection\\${missionId}")
    val workspaceDir=new File(parentDir,"workspace")
    val resultDir=new File(parentDir,"result")
    WorkflowMissionExecutor.featureSelection(workspaceDir, resultDir)
    Ok(views.html.test.test())
  }

}
